/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package intopo.game;

import java.io.DataInput;
import java.io.IOException;

/**
 * A {@code ReadStrategy} is used by the applications that process the results of simulation run.  These results contain strategy properties which are stored in
 * table <i>Player</i>.  These applications are generified in order to work with any game and strategy.  Implementors of this interface provide the mechanism to read strategies.  If a game was several classes that represent different strategy spaces, the implementor must be aware that different strategies may be written to the table.  Therefore, some of way of
 * discriminating the class must be put into place.
 *
 *
 * @author <a href="mailto:mariano.pedro@gmail.com">Pedro Mariano</a>
 * @version 1.0
 */
public interface ReadStrategy<S extends Strategy<S>>
{
	/**
	 * Return the maximum size in bytes of a strategy.  The application that processes the results of a simulation assumes that the chromosome data is stored in a fixed-length record.  This means that if a game can have different strategies, pad bytes and/or type information must be written.
	 * @return the maximum size in bytes of a strategy
	 */
	public int strategySize ();
	/**
	 * Return an instance of the strategy stored in the given input stream.
	 *
	 * <p> If a game was several classes that represent different strategy spaces, the implementor must be aware that different strategies may be written to the table.  Therefore, some of way of
	 * discriminating the class must be put into place.
	 *
	 * @param dis The input stream where the strategy is stored.
	 * @return an instance of the strategy stored in the given input stream.
	 * @throws java.io.IOException If an IO error occurs.
	 */
	S read (DataInput dis)
		throws IOException;
}

// Local Variables:
// mode: java
// mode: flyspell-prog
// ispell-local-dictionary: "british"
// End:
